home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / EVNT_MES.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-07  |  2.0 KB  |  77 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <memory.h>
  9. #include "XA_DEFS.H"
  10. #include "XA_TYPES.H"
  11. #include "XA_GLOBL.H"
  12. #include "K_DEFS.H"
  13. #include "RECTLIST.H"
  14. #include "OBJECTS.H"
  15.  
  16. /*
  17.     AES message handling
  18. */
  19. unsigned long XA_evnt_mesag(short clnt_pid, AESPB *pb)
  20. {
  21.     short *clnt_buf=(short*)(pb->addrin[0]);
  22.     short f;
  23.     short rtn;
  24.     XA_AESMSG_LIST *msg;
  25.     WidgetCallback wc,disp;
  26.     XA_PENDING_WIDGET *pending;
  27.     XA_WIDGET *widg;
  28.     XA_WINDOW *wind;
  29.  
  30. /* Is there a widget still active (like a scroll arrow)? If so, check with the action first */
  31. /* as it may result in some messages (just in case we've not got any already) */
  32.     if (!clients[clnt_pid].msg)
  33.     {
  34.         if (clients[clnt_pid].widget_active)
  35.         {
  36.             pending=clients[clnt_pid].widget_active;
  37.             wc=pending->action;
  38.             widg=pending->widg;
  39.             wind=pending->wind;
  40.             rtn=(*wc)(pending->wind, pending->widg);    /* Call the pending action */
  41.  
  42.             if (rtn)    /* If the widget click/drag function returned TRUE we reset the state of the widget */
  43.             {
  44.                 XA_RECT_LIST *rl=rect_get_system_first(wind);
  45.  
  46.                 widg->stat=XAW_PLAIN;                    /* Flag the widget as de-selected */
  47.                 disp=widg->behaviour[XACB_DISPLAY];        /* get the redraw function for this widget */
  48.  
  49.                 v_hide_c(V_handle);
  50.                 for(rl=rl; rl; rl=rect_get_system_next(wind))    /* Walk the rectangle list */
  51.                 {
  52.                     set_clip(rl->x,rl->y,rl->w,rl->h);
  53.                     (*disp)(wind, widg);
  54.                 }
  55.                 v_show_c(V_handle, 1);
  56.             }
  57.         }
  58.     }
  59.  
  60.     if (clients[clnt_pid].msg)    /* Are there any messages pending? */
  61.     {
  62.         msg=clients[clnt_pid].msg;
  63.         clients[clnt_pid].msg=msg->next;
  64.         
  65.         for(f=0; f<8; f++)        /* Copy the message into the clients buffer */
  66.             clnt_buf[f]=msg->message[f];
  67.  
  68.         pb->intout[0]=1;
  69.         return XAC_DONE;        /* Return TRUE to unblock the client */
  70.     }
  71.     
  72.     clients[clnt_pid].waiting_for=XAWAIT_MESSAGE;    /* Mark the client as waiting for messages */
  73.     clients[clnt_pid].waiting_pb=pb;
  74.     
  75.     return XAC_BLOCK;
  76. }
  77.